const express = require('express')
const history = require('connect-history-api-fallback');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = new express()

app.use(history())

const proxyInstance = createProxyMiddleware({
  target: 'http://ihrm.itheima.net',
  changeOrigin: true,
  pathRewrite: {
    '/prod-api': '/api'
  }
})
app.use('/prod-api', proxyInstance)

app.use(express.static(__dirname + '/dist'))

app.listen(3333, () => {
  console.log('http://localhost:3333');
})